<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:jsf="http://xmlns.jcp.org/jsf"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">

    <div>
        <p:panel header="Edición y cierre de eventos" style="border:none;">
            <h:form id="formTableMeetingId">
                <p:dataTable value="#{meetingBean.listMeeting}" var="meeting"
                             paginator="true" rows="15" id="tableMeetingId"
                             paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}">
                    
                    <p:column width="5">
                        <p:menuButton styleClass="menubutton-for-table">  
                            <p:menuitem value="Editar" icon="ui-icon-pencil" 
                                        action="#{meetingBean.closeEvent(meeting)}"
                                        update=":panelPrincipalId">  
                                <f:setPropertyActionListener value="#{meeting}"
                                                             target="#{meetingBean.meeting}"/>
                                <f:setPropertyActionListener value="./pages/content/meeting/make_event.xhtml"
                                                             target="#{navigationBean.navigationContent}"/>
                            </p:menuitem>
                            <p:separator />  
                            <p:menuitem value="Asistencia" icon="ui-icon-note"
                                        ajax="false"
                                        update=":panelPrincipalId" action="#{meetingBean.initValuesForAssistance()}">
                                <f:setPropertyActionListener target="#{meetingBean.meeting}"
                                                             value="#{meeting}" />
                                <f:setPropertyActionListener target="#{navigationBean.navigationContent}"
                                                             value="./pages/content/meeting/assistance_bussiness_event.xhtml"/>
                            </p:menuitem>
                            <p:separator/>
                            <p:menuitem value="Abrir Evento" icon="ui-icon-check"
                                        action="#{meetingBean.openEvent(meeting)}"
                                        update="@form"/>  
                            <p:menuitem value="Cerrar Evento" icon="ui-icon-close" 
                                        action="#{meetingBean.closeEvent(meeting)}"
                                        update="@form"/>  
                            
                            
                        </p:menuButton>
                    </p:column>
                    
                    <p:column headerText="Nombre">
                        #{meeting.name}
                    </p:column>
                    <p:column headerText="Fecha">
                        #{meeting.startDate}
                    </p:column>
                    <p:column headerText="Estado">
                        #{meeting.idState.name}
                    </p:column>
                    <p:column headerText="Docente">
                        #{meeting.idTheacher.completeName}
                    </p:column>
                </p:dataTable>
            </h:form>
        </p:panel>
    </div>
</ui:composition>

